import os

from src.config import config


def del_file(path):
    for i in os.listdir(path):
        path_file = os.path.join(path, i)
        if os.path.isfile(path_file):
            os.remove(path_file)
        else:
            del_file(path_file)

def del_file_2(path_file):
    if os.path.isfile(path_file):
        os.remove(path_file)

def del_model_and_logs():
    del_file(config.latest_model_path)
    train_log_dir = os.path.join(config.logs_dir, "train")
    test_log_dir = os.path.join(config.logs_dir, "test")
    del_file(train_log_dir)
    del_file(test_log_dir)


if __name__ == '__main__':
    del_model_and_logs()
